<template>
  <div>
    <!-- 头部 -->
    <ul class="menu_top_list book_view_top">
      <li @click="add"><span>返回</span></li>
      <li>目录列表</li>
      <li></li>
    </ul>
    <!-- 内容 -->
    <div class="avtop">
      <div class="mulu">{{ book.listMu }}</div>
      <div class="Content_Frame1">
        <ul class="mulu_list">
          <router-link tag="li" :to="'/read?id=' + bookId" v-for="(item, index) in book.beCont" :key="'Info-' + index">
            {{ item.cont }}
          </router-link>

        </ul>
      </div>

    </div>


  </div>
</template>
  
  
<script>
import { getMu, } from '@/api/home';

export default {
  data() {
    return {
      num: null,
      orangeNum: null,
      bookId: null,
      ACfun: null,
      JKL: null,
      book: {},
    }
  },


  methods: {
    add() {
      this.$router.go(-1)//跳转页面
    },
    // add() {
    //   this.$router.back();
    //   localStorage.removeItem("loglevel:webpack-dev-server");
    //   // console.dir(this);
    //   // console.log(1);
    // }, 
    getMuFun() {
      getMu({ id: this.$route.query.id }).then(data => {
        let arr = data.muru
        // console.log(data.muru);

        let index = arr.findIndex(item => item.id == this.$route.query.id);
        var obj = arr.splice(index, 1);
        //  console.log(obj);
        this.book = obj[0]
        // console.log(this.book.beCont);
       this.bookId=this.$route.query.id
        console.log("bookid",this.bookId);
      })
    }


  },
  created() {
     // 获取json数据
    console.log(this.$route.query);
    if ("id" in this.$route.query) {
      this.getMuFun();
    }
  },



}
</script>
<style lang="scss">
.avtop {
  margin-top: 46.8px;
}
</style>
